package com.sweet.serializer;

import java.util.ArrayList;
import java.util.List;

/**
 * 用户模型
 */
public class UserModel {
    /**
     * 用户id
     */
    public static final int ID = 1;

    /**
     * 用户名
     */
    public static final String NAME = "mqn-lm";

    /**
     * 获取模型
     *
     * @return
     */
    public static UserBean getModel() {
        UserBean user = new UserBean();
        user.setId(ID);
        user.setName(NAME);
        return user;
    }

    /**
     * 获取模型集合
     *
     * @return
     */
    public static List<UserBean> getModelCollection() {
        List<UserBean> users = new ArrayList<>();
        for (int i = 0; i < 100; i++) {
            UserBean user = new UserBean();
            user.setId(ID);
            user.setName(NAME);
            users.add(user);
        }
        return users;
    }

    /**
     * 获取模型数组
     *
     * @return
     */
    public static UserBean[] getModelArray() {
        int size = 100;
        UserBean[] users = new UserBean[size];
        for (int i = 0; i < size; i++) {
            UserBean user = new UserBean();
            user.setId(ID);
            user.setName(NAME);
            users[i] = user;
        }
        return users;
    }
}